# Contributor: Sam Whited <sam@samwhited.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-slixmpp
_pkgname=slixmpp
pkgver=1.8.5
pkgrel=2
pkgdesc="Fork of the SleekXMPP XMPP library for async IO and Python 3.7+"
url="https://slixmpp.readthedocs.io/en/latest/"
arch="all"
license="MIT"
depends="
	py3-aiodns
	py3-aiohttp
	py3-cryptography
	py3-defusedxml
	py3-emoji
	"
makedepends="
	cython
	libidn-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	cmd:gpg
	py3-pytest
	"
subpackages="
	$pkgname-doc
	$pkgname-pyc
	"
source="https://files.pythonhosted.org/packages/source/s/slixmpp/slixmpp-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

# secfixes:
#   1.8.3-r0:
#     - CVE-2022-45197

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--ignore tests/live_test.py
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
	install -Dm644 README.rst -t "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
f2e123bd462097d0b7dc28cd960f723419f4fa2af59c8f5b7d30a05135c2f9fc6982e6d2855ea10b22936bdd4a96faeae73f87a495e2d1f10e6c63cdcb412665  slixmpp-1.8.5.tar.gz
"
